package com.neocean.archive.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.neocean.archive.mapper.HonorMapper;
import com.neocean.archive.domain.Honor;
import com.neocean.archive.service.IHonorService;

/**
 * 荣誉Service业务层处理
 * 
 * @author husb
 * @date 2021-11-16
 */
@Service
public class HonorServiceImpl implements IHonorService 
{
    @Autowired
    private HonorMapper honorMapper;

    /**
     * 查询荣誉
     * 
     * @param honorId 荣誉主键
     * @return 荣誉
     */
    @Override
    public Honor selectHonorByHonorId(Long honorId)
    {
        return honorMapper.selectHonorByHonorId(honorId);
    }

    /**
     * 查询荣誉列表
     * 
     * @param honor 荣誉
     * @return 荣誉
     */
    @Override
    public List<Honor> selectHonorList(Honor honor)
    {
        return honorMapper.selectHonorList(honor);
    }

    /**
     * 新增荣誉
     * 
     * @param honor 荣誉
     * @return 结果
     */
    @Override
    public int insertHonor(Honor honor)
    {
        honor.setCreatedBy(SecurityUtils.getUsername());
        honor.setCreatedAt(DateUtils.getNowDate());
        honor.setUpdatedBy(SecurityUtils.getUsername());
        honor.setUpdatedAt(DateUtils.getNowDate());
        return honorMapper.insertHonor(honor);
    }

    /**
     * 修改荣誉
     * 
     * @param honor 荣誉
     * @return 结果
     */
    @Override
    public int updateHonor(Honor honor)
    {
        //   product.setUpdatedBy(SecurityUtils.getUsername());
        honor.setUpdatedBy(SecurityUtils.getUsername());
        honor.setUpdatedAt(DateUtils.getNowDate());
        return honorMapper.updateHonor(honor);
    }

    /**
     * 批量删除荣誉
     * 
     * @param honorIds 需要删除的荣誉主键
     * @return 结果
     */
    @Override
    public int deleteHonorByHonorIds(Long[] honorIds)
    {
        return honorMapper.deleteHonorByHonorIds(honorIds);
    }

    /**
     * 删除荣誉信息
     * 
     * @param honorId 荣誉主键
     * @return 结果
     */
    @Override
    public int deleteHonorByHonorId(Long honorId)
    {
        return honorMapper.deleteHonorByHonorId(honorId);
    }
}
